package morenoapp.util;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;

/**
 *
 * @author root
 */
public class MorenoCollections {
    public static <T> List<T> toList(Enumeration<T> _enum){
        List<T> result = new ArrayList<T>();
        while(_enum.hasMoreElements()){
            result.add(_enum.nextElement());
        }
        return result;
    }

    public static <T> Iterable<T> toIterable(final Iterator<T> _iterator){
        return new Iterable<T>(){
            @Override
            public Iterator<T> iterator() {
                return _iterator;
            }
        };
    }
}
